home *** CD-ROM | disk | FTP | other *** search
/ DOpus Plus / DOpus Plus.iso / Enhancements / RandomTheme / ARexx / RandomTheme.dopus5
Encoding:
Text File  |  1998-10-23  |  1.4 KB  |  49 lines

  1. /*
  2. $VER: RandomTheme.dopus5 0.3 (23.10.98)
  3.  
  4. Use it in the StartUp event or whereever you like, have it executed by Cron,
  5. (or Helmut's timer.module), to change every 30 minutes ;-)
  6.  
  7. Call as:  ARexx     RandomTheme.dopus5 <port> [TOTAL]
  8.  
  9.           Run Async
  10.  
  11. where:    port  = Opus ARexx port, {Qp} parameter if you're lazy.
  12.           TOTAL = Keyword specifying the theme will be loaded in total, the
  13.                   alternative is to load random parts of it :-)
  14.  
  15. REQUIRES: rexxtricks.library in Libs: available from Aminet as
  16.           util/rexx/RexxTricks_386.lha
  17.  
  18. */
  19. parse arg port args .
  20. options results
  21. if args = '' then args = port
  22. args = args ~= port
  23. if left(port,6) ~= 'DOPUS.' then do
  24.   port = 'DOPUS.1'
  25.   args = 1
  26.   end
  27. address value upper(port)
  28. if ~show('l','rexxtricks.library') then
  29.   if ~addlib('rexxtricks.library',0,-30) then exit
  30.  
  31. call getdir('D5Themes:','#?.theme','themes','f','n')
  32. if themes.0 = 0 then exit
  33. x = rand(1,themes.0)
  34.  
  35. appargs = ''
  36. do while length(appargs) ~> 1
  37.   if rand(1,10) > 5 then appargs = appargs||'APPLYSOUNDS '
  38.   if rand(1,10) > 5 then appargs = appargs||'APPLYFONTS '
  39.   if rand(1,10) > 5 then appargs = appargs||'APPLYPALETTE '
  40.   if rand(1,10) > 5 then appargs = appargs||'APPLYBACKGROUNDS '
  41. end
  42. appargs = strip(appargs)
  43.  
  44. if args then
  45.   command 'LoadTheme 'themes.x' APPLYSOUNDS APPLYFONTS APPLYPALETTE APPLYBACKGROUNDS'
  46. else
  47.   command 'LoadTheme 'themes.x' 'appargs
  48. exit
  49.